package trustedPlatformBackup;

import java.io.BufferedReader;
import java.io.BufferedWriter;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.Properties;

import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.custom.CLabel;

public class VCMainWindow {

	private Shell sShell = null; // @jve:decl-index=0:visual-constraint="87,51"
	private Composite compositeMain = null;
	private TabFolder tabFolder = null;
	private Composite composite1 = null;
	private Composite composite2 = null;
	private Group groupDatum = null;
	private SashForm sashForm = null;
	private SashForm composite3 = null;
	private SashForm composite4 = null;
	private Tree wFolderTree = null;
	private List wTimeBackupList = null;
	private List wDayBackupList = null;
	private Text wURLText = null;
	private Composite composite5 = null;
	private Table wFileTable = null;
	private ArrayList<SortFile> alFileTable = new ArrayList<SortFile>(); // @jve:decl-index=0:

	

	private Label label = null;
	private Text wBackupFolderText = null;
	private Text wDataFolderText = null;
	private Button wFindDataFolderButton = null;
	private Button wFindBackupFolderButton = null;
	private Button wSavePropertiesButton = null;
	private Label label1 = null;
	private Button wSetDefaultButton = null;
	private Text wDayTimeText = null;
	private Composite composite = null;
	private Button wDoFullBackupButton = null;
	private Button wDoDiffBackupButton = null;
	private Button wDoSubDataBackupButton = null;
	private Composite composite6 = null;
	private Button wRecoverFileButton = null;
	private Button wViewAllFileVersionsButton = null;
	private Table wFileVersionsTable = null;
	private Text wURLFileText = null;
	private Composite composite7 = null;
	private Label label3 = null;
	private Text wTPMInitScriptText = null;
	private Label label4 = null;
	private Label label5 = null;
	private Label label6 = null;
	private Label label7 = null;
	private Button wGenerateTPMKeyButton = null;
	private Label label8 = null;
	private Label label9 = null;
	private Label Username = null;
	private Text wSSHHostText = null;
	private Text wSSHUserText = null;
	private Button wSendTPMKeyButton = null;
	private Button wHardlinkModeCheckBox = null;
	private Text wFindECryptFSMountPointFolderText = null;
	private Text wFindECryptFSSrcFolderText = null;
	private Label label10 = null;
	private Button wFindECryptFSMountPointFolderButton = null;
	private Button wFindECryptFSSrcFolderButton = null;
	private Button wFindScriptFolderButton = null;
	private Label label11 = null;
	private Label label12 = null;
	private Label label13 = null;
	private Label label14 = null;
	/**
	 * This method initializes groupDatum
	 * 
	 */
	private void createGroupDatum() {
		GridLayout gridLayout4 = new GridLayout();
		gridLayout4.marginHeight = 0;
		gridLayout4.marginWidth = 0;
		gridLayout4.verticalSpacing = 0;
		gridLayout4.numColumns = 1;
		gridLayout4.horizontalSpacing = 0;
		GridData gridData1 = new GridData();
		gridData1.horizontalAlignment = GridData.FILL;
		gridData1.grabExcessHorizontalSpace = true;
		gridData1.grabExcessVerticalSpace = true;
		gridData1.verticalAlignment = GridData.FILL;
		groupDatum = new Group(composite1, SWT.NONE);
		groupDatum.setText("Datum Wiederherstellen");
		createSashForm();
		groupDatum.setLayout(gridLayout4);
		createComposite();
		
		groupDatum.setLayoutData(gridData1);
	}

	/**
	 * This method initializes sashForm
	 * 
	 */
	private void createSashForm() {
		GridData gridData12 = new GridData();
		gridData12.grabExcessHorizontalSpace = true;
		gridData12.horizontalAlignment = GridData.FILL;
		gridData12.verticalAlignment = GridData.FILL;
		gridData12.grabExcessVerticalSpace = true;
		sashForm = new SashForm(groupDatum, SWT.NONE);
		sashForm.setBackground(new Color(Display.getCurrent(), 192, 192, 192));
		createComposite3();
		createComposite5();
		sashForm.setLayoutData(gridData12);
		createComposite4();

		/*
		 * sashForm.addListener(SWT.Selection, new Listener() { public void
		 * handleEvent(Event e) { if (e.detail == SWT.DRAG) return; GridData
		 * data = (GridData) wFolderTree.getLayoutData(); Rectangle trim =
		 * wFolderTree.computeTrim(0, 0, 0, 0); data.widthHint = e.x -
		 * trim.width; sashForm.layout(); } });
		 */
		sashForm.setWeights(new int[] { 120, 200, 400 });

		sashForm.layout();
	}

	/**
	 * This method initializes composite3
	 * 
	 */
	private void createComposite3() {
		GridData gridData6 = new GridData();
		gridData6.horizontalAlignment = GridData.FILL;
		gridData6.grabExcessHorizontalSpace = true;
		gridData6.heightHint = -1;
		gridData6.widthHint = -1;
		gridData6.horizontalSpan = 2;
		gridData6.grabExcessVerticalSpace = true;
		gridData6.verticalAlignment = GridData.FILL;
		GridData gridData5 = new GridData();
		gridData5.horizontalAlignment = GridData.FILL;
		gridData5.widthHint = -1;
		gridData5.horizontalSpan = 2;
		gridData5.grabExcessHorizontalSpace = true;
		gridData5.heightHint = 100;
		gridData5.verticalAlignment = GridData.FILL;
		GridLayout gridLayout1 = new GridLayout();
		gridLayout1.numColumns = 2;
		GridData gridData2 = new GridData();
		gridData2.horizontalAlignment = GridData.FILL;
		gridData2.grabExcessHorizontalSpace = true;
		gridData2.grabExcessVerticalSpace = true;
		gridData2.widthHint = 100;
		gridData2.horizontalSpan = 2;
		gridData2.verticalAlignment = GridData.FILL;
		composite3 = new SashForm(sashForm, SWT.VERTICAL);
		composite3.setBackground(new Color(Display.getCurrent(), 192, 192, 192));
		composite3.setLayout(gridLayout1);
		wDayBackupList = new List(composite3, SWT.V_SCROLL);
		wDayBackupList.setLayoutData(gridData6);

		wTimeBackupList = new List(composite3, SWT.V_SCROLL);
		wTimeBackupList.setLayoutData(gridData5);

	}

	/**
	 * This method initializes composite4
	 * 
	 */
	private void createComposite4() {
		GridData gridData18 = new GridData();
		gridData18.horizontalAlignment = GridData.FILL;
		gridData18.grabExcessHorizontalSpace = true;
		gridData18.heightHint = 70;
		gridData18.grabExcessVerticalSpace = false;
		gridData18.horizontalSpan = 2;
		gridData18.verticalAlignment = GridData.FILL;
		GridData gridData13 = new GridData();
		gridData13.horizontalAlignment = GridData.FILL;
		gridData13.grabExcessHorizontalSpace = true;
		gridData13.grabExcessVerticalSpace = true;
		gridData13.horizontalSpan = 2;
		gridData13.verticalAlignment = GridData.FILL;
		GridLayout gridLayout2 = new GridLayout();
		GridData gridData8 = new GridData();
		gridData8.grabExcessHorizontalSpace = true;
		gridData8.verticalAlignment = GridData.CENTER;
		gridData8.horizontalAlignment = GridData.FILL;
		composite4 = new SashForm(sashForm, SWT.VERTICAL);
		composite4.setBackground(new Color(Display.getCurrent(), 192, 192, 192));
		
		createComposite7();
		composite4.setLayout(gridLayout2);
		
		

		createComposite6();
		
		

		wFileTable.addListener(SWT.SetData, new Listener() {
			public void handleEvent(Event e) {
				TableItem item = (TableItem) e.item;
				int index = wFileTable.indexOf(item);

				SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm");
				// int[] datum = data[index];
				item.setText(new String[] { alFileTable.get(index).getName(), Long.toString(alFileTable.get(index).length() / 1000) + " KB",
						sdf.format(new Date(alFileTable.get(index).lastModified())), alFileTable.get(index).getAbsolutePath() });

				if (alFileTable.get(index).isDirectory()) {
					item.setImage(CCommonConstants.IMAGE_FOLDER);
				} else {
					item.setImage(CCommonConstants.IMAGE_FILE);
				}
				item.setData(alFileTable.get(index));
			}
		});
		composite4.setWeights(new int[] { 3, 1 });
		composite4.layout();
		

	}



	/**
	 * This method initializes composite5
	 * 
	 */
	private void createComposite5() {
		GridData gridData16 = new GridData();
		gridData16.horizontalAlignment = GridData.FILL;
		gridData16.verticalAlignment = GridData.CENTER;
		GridLayout gridLayout5 = new GridLayout();
		gridLayout5.numColumns = 2;
		GridData gridData9 = new GridData();
		gridData9.widthHint = 150;
		gridData9.horizontalAlignment = GridData.FILL;
		gridData9.verticalAlignment = GridData.FILL;
		gridData9.grabExcessVerticalSpace = true;
		gridData9.grabExcessHorizontalSpace = true;
		composite5 = new Composite(sashForm, SWT.NONE);
		composite5.setLayout(gridLayout5);
		wDayTimeText = new Text(composite5, SWT.BORDER);
		wDayTimeText.setText(CCommonConstants.DATA_LABEL);
		wDayTimeText.setEditable(false);
		wDayTimeText.setLayoutData(gridData16);
		Label filler1 = new Label(composite5, SWT.NONE);
		wFolderTree = new Tree(composite5, SWT.NONE);
		wFolderTree.setLayoutData(gridData9);
		// File[] roots = File.listRoots();

	}

	/**
	 * This method initializes sShell
	 */
	public void createSShell() {
		sShell = new Shell();
		getsShell().setText("TrustedBackup GUI");
		createCompositeMain();
		getsShell().setSize(new Point(1034, 698));
		getsShell().setLayout(new GridLayout());
	}

	/**
	 * This method initializes compositeMain
	 * 
	 */
	private void createCompositeMain() {
		GridLayout gridLayout3 = new GridLayout();
		gridLayout3.horizontalSpacing = 0;
		gridLayout3.marginWidth = 0;
		gridLayout3.marginHeight = 0;
		gridLayout3.verticalSpacing = 0;
		GridData gridData10 = new GridData();
		gridData10.horizontalAlignment = GridData.FILL;
		gridData10.grabExcessHorizontalSpace = true;
		gridData10.grabExcessVerticalSpace = true;
		gridData10.verticalAlignment = GridData.FILL;
		compositeMain = new Composite(sShell, SWT.NONE);
		compositeMain.setLayoutData(gridData10);
		compositeMain.setLayout(gridLayout3);
		createTabFolder();
	}

	/**
	 * This method initializes tabFolder
	 * 
	 */
	private void createTabFolder() {
		GridData gridData11 = new GridData();
		gridData11.horizontalAlignment = GridData.FILL;
		gridData11.grabExcessHorizontalSpace = true;
		gridData11.grabExcessVerticalSpace = true;
		gridData11.verticalAlignment = GridData.FILL;
		tabFolder = new TabFolder(compositeMain, SWT.NONE);
		createComposite1();
		tabFolder.setLayoutData(gridData11);
		createComposite2();

		TabItem tabItem1 = new TabItem(tabFolder, SWT.NONE);
		tabItem1.setText("Daten Wiederherstellen");
		tabItem1.setControl(composite1);
		TabItem tabItem2 = new TabItem(tabFolder, SWT.NONE);
		tabItem2.setText("Einstellungen");
		tabItem2.setControl(composite2);
	}

	/**
	 * This method initializes composite1
	 * 
	 */
	private void createComposite1() {
		GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		composite1 = new Composite(tabFolder, SWT.NONE);
		createGroupDatum();
		composite1.setLayout(gridLayout);
	}

	/**
	 * This method initializes composite2
	 * 
	 */
	private void createComposite2() {
		GridData gridData29 = new GridData();
		gridData29.widthHint = 100;
		GridData gridData28 = new GridData();
		gridData28.widthHint = 100;
		GridData gridData27 = new GridData();
		gridData27.horizontalAlignment = GridData.FILL;
		gridData27.verticalAlignment = GridData.CENTER;
		GridData gridData26 = new GridData();
		gridData26.horizontalAlignment = GridData.FILL;
		gridData26.widthHint = 350;
		gridData26.verticalAlignment = GridData.CENTER;
		GridData gridData25 = new GridData();
		gridData25.horizontalAlignment = GridData.FILL;
		gridData25.widthHint = 350;
		gridData25.verticalAlignment = GridData.CENTER;
		GridData gridData4 = new GridData();
		gridData4.horizontalAlignment = GridData.FILL;
		gridData4.verticalAlignment = GridData.CENTER;
		GridData gridData3 = new GridData();
		gridData3.horizontalAlignment = GridData.FILL;
		gridData3.grabExcessHorizontalSpace = false;
		gridData3.widthHint = 350;
		gridData3.verticalAlignment = GridData.CENTER;
		GridData gridData15 = new GridData();
		gridData15.horizontalAlignment = GridData.FILL;
		gridData15.verticalAlignment = GridData.CENTER;
		GridData gridData14 = new GridData();
		gridData14.widthHint = 350;
		GridData gridData7 = new GridData();
		gridData7.widthHint = 350;
		GridLayout gridLayout6 = new GridLayout();
		gridLayout6.numColumns = 3;
		composite2 = new Composite(tabFolder, SWT.NONE);
		composite2.setLayout(gridLayout6);
		label14 = new Label(composite2, SWT.NONE);
		label14.setText("Backup Optionen");
		Label filler5 = new Label(composite2, SWT.NONE);
		Label filler6 = new Label(composite2, SWT.NONE);
		label = new Label(composite2, SWT.NONE);
		label.setText("Backup root Verzeichnis:");
		wBackupFolderText = new Text(composite2, SWT.BORDER);
		wBackupFolderText.setEditable(false);
		wBackupFolderText.setLayoutData(gridData14);
		wFindBackupFolderButton = new Button(composite2, SWT.NONE);
		wFindBackupFolderButton.setText("Suchen...");
		label1 = new Label(composite2, SWT.NONE);
		label1.setText("Daten Verzeichnis:");

		

		wDataFolderText = new Text(composite2, SWT.BORDER);
		wDataFolderText.setEditable(false);
		wDataFolderText.setLayoutData(gridData7);
		wFindDataFolderButton = new Button(composite2, SWT.NONE);
		wFindDataFolderButton.setText("Suchen...");
		label5 = new Label(composite2, SWT.NONE);
		label5.setText("Script Folder");
		wTPMInitScriptText = new Text(composite2, SWT.BORDER);
		wTPMInitScriptText.setEditable(false);
		wTPMInitScriptText.setLayoutData(gridData3);
		wFindScriptFolderButton = new Button(composite2, SWT.NONE);
		wFindScriptFolderButton.setText("Suchen...");
		label4 = new Label(composite2, SWT.NONE);
		label4.setText("Hardlink Mode");
		wHardlinkModeCheckBox = new Button(composite2, SWT.CHECK);
		wHardlinkModeCheckBox.setLayoutData(gridData4);
		Label filler8 = new Label(composite2, SWT.NONE);
		label10 = new Label(composite2, SWT.NONE);
		label10.setText("");
		Label filler = new Label(composite2, SWT.NONE);
		Label filler2 = new Label(composite2, SWT.NONE);
		label6 = new Label(composite2, SWT.NONE);
		label6.setText("ecryptFS Moutpoint");
		wFindECryptFSMountPointFolderText = new Text(composite2, SWT.BORDER);
		wFindECryptFSMountPointFolderText.setLayoutData(gridData25);
		wFindECryptFSMountPointFolderButton = new Button(composite2, SWT.NONE);
		wFindECryptFSMountPointFolderButton.setText("Suchen...");
		
		
		label7 = new Label(composite2, SWT.NONE);
		label7.setText("ecryptFS srcFolder");
		wFindECryptFSSrcFolderText = new Text(composite2, SWT.BORDER);
		wFindECryptFSSrcFolderText.setLayoutData(gridData26);
		wFindECryptFSSrcFolderButton = new Button(composite2, SWT.NONE);
		wFindECryptFSSrcFolderButton.setText("Suchen...");
		
		label12 = new Label(composite2, SWT.NONE);
		label12.setText("");
		Label filler513 = new Label(composite2, SWT.NONE);
		Label filler514 = new Label(composite2, SWT.NONE);
		wSetDefaultButton = new Button(composite2, SWT.NONE);
		wSetDefaultButton.setText("Zurücksetzen");
		Label filler54 = new Label(composite2, SWT.NONE);
		wSavePropertiesButton = new Button(composite2, SWT.NONE);
		wSavePropertiesButton.setText("Speichern");
		wSavePropertiesButton.setLayoutData(gridData15);

		label13 = new Label(composite2, SWT.NONE);
		label13.setText("");
		Label filler516 = new Label(composite2, SWT.NONE);
		Label filler5171 = new Label(composite2, SWT.NONE);
		label11 = new Label(composite2, SWT.NONE);
		label11.setText("TPM Optionen");
		Label filler4 = new Label(composite2, SWT.NONE);
		Label filler58 = new Label(composite2, SWT.NONE);
		label8 = new Label(composite2, SWT.NONE);
		label8.setText("TPM Key Verteilen");
		Label filler521 = new Label(composite2, SWT.NONE);
		Label filler522 = new Label(composite2, SWT.NONE);
		label9 = new Label(composite2, SWT.NONE);
		label9.setText("Host:");
		wSSHHostText = new Text(composite2, SWT.BORDER);
		wSSHHostText.setLayoutData(gridData28);
		Label filler525 = new Label(composite2, SWT.NONE);
		Username = new Label(composite2, SWT.NONE);
		Username.setText("Username:");
		wSSHUserText = new Text(composite2, SWT.BORDER);
		wSSHUserText.setLayoutData(gridData29);
		wSendTPMKeyButton = new Button(composite2, SWT.NONE);
		wSendTPMKeyButton.setText("TPM Key Senden");
		wSendTPMKeyButton.setLayoutData(gridData27);
		Label filler511 = new Label(composite2, SWT.NONE);
		wGenerateTPMKeyButton = new Button(composite2, SWT.NONE);
		wGenerateTPMKeyButton.setText("TPM Key Erstellen");
		
	}

	

	public class SortFile extends File implements Comparable<File> {
		public int dir = 1;

		public SortFile(File parent, String child) {
			super(parent, child);
			// TODO Auto-generated constructor stub
		}

		public SortFile(String parent, String child) {
			super(parent, child);
			// TODO Auto-generated constructor stub
		}

		public SortFile(String pathname) {
			super(pathname);
			// TODO Auto-generated constructor stub
		}

		public SortFile(URI uri) {
			super(uri);
			// TODO Auto-generated constructor stub
		}

		// Die Methode wird durch Comparable vorgeschrieben.
		public int compareTo(java.io.File argument) {
			int dir = wFileTable.getSortDirection();
			System.out.println(dir);
			if (dir == SWT.DOWN)
				return getName().compareToIgnoreCase(argument.getName());
			else
				return getName().compareToIgnoreCase(argument.getName()) * -1;

		}
	}



	public void setsShell(Shell sShell) {
		this.sShell = sShell;
	}

	public Shell getsShell() {
		return sShell;
	}

	public Button getwSavePropertiesButton() {
		return wSavePropertiesButton;
	}

	public Text getwBackupFolderText() {
		return wBackupFolderText;
	}

	public Text getwDataFolderText() {
		return wDataFolderText;
	}

	public Tree getwFolderTree() {
		return wFolderTree;
	}

	public Table getwFileTable() {
		return wFileTable;
	}

	public Text getwURLText() {
		return wURLText;
	}

	public List getwTimeBackupList() {
		return wTimeBackupList;
	}

	public List getwDayBackupList() {
		return wDayBackupList;
	}
	public void setAlFileTable(ArrayList<SortFile> alFileTable) {
		this.alFileTable = alFileTable;
	}

	public ArrayList<SortFile> getAlFileTable() {
		return alFileTable;
	}

	public SortFile getNewSortFile(String absolutePath) {
		return (new SortFile(absolutePath));
	
	}
	public Button getwSetDefaultButton() {
		return wSetDefaultButton;
	}
	public Text getwURLFileText() {
		return wURLFileText;
	}

	public Button getwViewAllFileVersionsButton() {
		return wViewAllFileVersionsButton;
	}
	public Table getwFileVersionsTable() {
		return wFileVersionsTable;
	}
	public Button getwRecoverFileButton() {
		return wRecoverFileButton;
	}

	public Button getwHardlinkModeCheckBox() {
		return wHardlinkModeCheckBox;
	}

	public Button getwFindDataFolderButton() {
		return wFindDataFolderButton;
	}

	public Button getwFindBackupFolderButton() {
		return wFindBackupFolderButton;
	}

	public Text getwFindECryptFSMountPointFolderText() {
		return wFindECryptFSMountPointFolderText;
	}

	public Text getwFindECryptFSSrcFolderText() {
		return wFindECryptFSSrcFolderText;
	}

	public Button getwFindECryptFSMountPointFolderButton() {
		return wFindECryptFSMountPointFolderButton;
	}

	public Button getwFindECryptFSSrcFolderButton() {
		return wFindECryptFSSrcFolderButton;
	}

	public Button getwFindScriptFolderButton() {
		return wFindScriptFolderButton;
	}

	public Text getwTPMInitScriptText() {
		return wTPMInitScriptText;
	}

	/**
	 * This method initializes composite	
	 *
	 */
	private void createComposite() {
		GridData gridData24 = new GridData();
		gridData24.horizontalAlignment = GridData.FILL;
		gridData24.grabExcessHorizontalSpace = true;
		gridData24.verticalAlignment = GridData.CENTER;
		GridData gridData19 = new GridData();
		gridData19.horizontalAlignment = GridData.BEGINNING;
		gridData19.grabExcessHorizontalSpace = false;
		gridData19.verticalAlignment = GridData.CENTER;
		GridData gridData = new GridData();
		gridData.grabExcessHorizontalSpace = true;
		gridData.verticalAlignment = GridData.CENTER;
		gridData.horizontalAlignment = GridData.FILL;
		GridLayout gridLayout7 = new GridLayout();
		gridLayout7.numColumns = 6;
		composite = new Composite(groupDatum, SWT.NONE);
		composite.setLayout(gridLayout7);
		composite.setLayoutData(gridData);
		wDoFullBackupButton = new Button(composite, SWT.NONE);
		wDoFullBackupButton.setText("Daten komplett sichern");
		
		wDoDiffBackupButton = new Button(composite, SWT.NONE);
		wDoDiffBackupButton.setText("Daten-Differential erstellen");
		wDoSubDataBackupButton = new Button(composite, SWT.NONE);
		wDoSubDataBackupButton.setText("Ausgewählte Dateien sichern");
		label3 = new Label(composite, SWT.NONE);
		label3.setLayoutData(gridData24);
		
		wViewAllFileVersionsButton = new Button(composite, SWT.NONE);
		wViewAllFileVersionsButton.setText("Alle Versionen anzeigen");
		wRecoverFileButton = new Button(composite, SWT.NONE);
		wRecoverFileButton.setText("Datei/Verzeichnis Wiederherstellen");
		wRecoverFileButton.setLayoutData(gridData19);
		
	}

	public Button getwDoFullBackupButton() {
		return wDoFullBackupButton;
	}

	/**
	 * This method initializes composite6	
	 *
	 */
	private void createComposite6() {
		GridData gridData23 = new GridData();
		gridData23.horizontalAlignment = GridData.FILL;
		gridData23.grabExcessHorizontalSpace = true;
		gridData23.grabExcessVerticalSpace = true;
		gridData23.verticalAlignment = GridData.FILL;
		GridData gridData20 = new GridData();
		gridData20.horizontalAlignment = GridData.FILL;
		gridData20.grabExcessHorizontalSpace = true;
		gridData20.grabExcessVerticalSpace = false;
		gridData20.verticalAlignment = GridData.CENTER;
		GridData gridData17 = new GridData();
		gridData17.horizontalSpan = 2;
		gridData17.verticalAlignment = GridData.CENTER;
		gridData17.horizontalAlignment = GridData.FILL;
		GridLayout gridLayout8 = new GridLayout();
		gridLayout8.numColumns = 1;
	
		composite6 = new Composite(composite4, SWT.NONE);
		composite6.setLayout(gridLayout8);
		composite6.setLayoutData(gridData17);
		wURLFileText = new Text(composite6, SWT.BORDER);
		wURLFileText.setEditable(false);
		wURLFileText.setLayoutData(gridData20);
		wFileVersionsTable = new Table(composite6, SWT.FULL_SELECTION);
		wFileVersionsTable.setHeaderVisible(true);
		wFileVersionsTable.setLayoutData(gridData23);
		
		wFileVersionsTable.setLinesVisible(true);
		
		TableColumn tableColumn11 = new TableColumn(getwFileVersionsTable(), SWT.NONE);
		tableColumn11.setWidth(120);
		tableColumn11.setText("Backup");
		TableColumn tableColumn = new TableColumn(getwFileVersionsTable(), SWT.NONE);
		tableColumn.setWidth(150);
		tableColumn.setText("Name");
		TableColumn tableColumn4 = new TableColumn(getwFileVersionsTable(), SWT.NONE);
		tableColumn4.setWidth(50);
		tableColumn4.setText("Größe");
		TableColumn tableColumn5 = new TableColumn(getwFileVersionsTable(), SWT.NONE);
		tableColumn5.setWidth(100);
		tableColumn5.setText("Geändert am");
		TableColumn tableColumn6 = new TableColumn(getwFileVersionsTable(), SWT.NONE);
		tableColumn6.setWidth(200);
		tableColumn6.setText("Pfad");
	
	}

	/**
	 * This method initializes composite7	
	 *
	 */
	private void createComposite7() {
		GridData gridData22 = new GridData();
		gridData22.grabExcessHorizontalSpace = true;
		gridData22.verticalAlignment = GridData.CENTER;
		gridData22.horizontalAlignment = GridData.FILL;
		GridData gridData21 = new GridData();
		gridData21.horizontalAlignment = GridData.FILL;
		gridData21.grabExcessHorizontalSpace = true;
		gridData21.grabExcessVerticalSpace = true;
		gridData21.verticalAlignment = GridData.FILL;
		composite7 = new Composite(composite4, SWT.NONE);
		composite7.setLayout(new GridLayout());
		wURLText = new Text(composite7, SWT.BORDER);
		wURLText.setText("/");
		wURLText.setLayoutData(gridData22);
		wURLText.setEditable(false);
		
		wFileTable = new Table(composite7, SWT.VIRTUAL | SWT.FULL_SELECTION);
		wFileTable.setHeaderVisible(true);
		wFileTable.setLayoutData(gridData21);
		
		wFileTable.setLinesVisible(true);
		final TableColumn tableColumnName = new TableColumn(wFileTable, SWT.NONE);
		tableColumnName.setWidth(150);
		tableColumnName.setText("Name");
		TableColumn tableColumn1 = new TableColumn(wFileTable, SWT.NONE);
		tableColumn1.setWidth(50);
		tableColumn1.setText("Größe");
		TableColumn tableColumn2 = new TableColumn(wFileTable, SWT.NONE);
		tableColumn2.setWidth(100);
		tableColumn2.setText("Geändert am");
		TableColumn tableColumn3 = new TableColumn(wFileTable, SWT.NONE);
		tableColumn3.setWidth(200);
		tableColumn3.setText("Pfad");
		
		Listener sortListener = new Listener() {
			public void handleEvent(Event e) {
				// determine new sort column and direction
				TableColumn sortColumn = wFileTable.getSortColumn();
				TableColumn currentColumn = (TableColumn) e.widget;
				int dir = wFileTable.getSortDirection();
				if (sortColumn == currentColumn) {
					dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;

				} else {
					wFileTable.setSortColumn(currentColumn);
					dir = SWT.UP;
				}
				// sort the data based on column and direction
				final int index = currentColumn == tableColumnName ? 0 : 1;
				final int direction = dir;

				Collections.sort(alFileTable);

				wFileTable.setSortDirection(dir);
				wFileTable.clearAll();
			}
		};
		tableColumnName.addListener(SWT.Selection, sortListener);

	}
	
}
